package example;

import java.util.ArrayList;
import java.util.List;

import br.mcaslib.collections.ListRemoteViewVo;

public class LoadExample {

	public final int REAL_LENGTH = 50000;

	public ListRemoteViewVo load( ListRemoteViewVo listRemoteViewVo ) {
		listRemoteViewVo.setData( this.generateData(listRemoteViewVo.getIndex(), listRemoteViewVo.getMaxLength()) );
		listRemoteViewVo.setRealLength(REAL_LENGTH);
		return listRemoteViewVo;
	}

	protected List<DataInfo> generateData( int index, int length ) {
		List<DataInfo> list = new ArrayList<DataInfo>();
		for( int i = index; (i < index + length) && (i < REAL_LENGTH); i++ ) {
			String sI = Integer.toString(i);
			DataInfo dataInfo = new DataInfo();
			dataInfo.setData1( sI+".data1" );
			dataInfo.setData2( sI+".data2" );
			dataInfo.setData3( sI+".data3" );
			list.add(dataInfo);
		}
		return list;
	}

}
